import React from 'react'
import { useRoutes } from 'react-router-dom'

const Home = React.lazy(() => import('../views/home'))
const Detail = React.lazy(() => import('../views/detail'))
const PayResult = React.lazy(() => import('../views/payResult'))

export const Router_List = [
  {
    path: '/',
    element: <Home></Home>,
  },
  {
    path: '/detail/:id',
    element: <Detail></Detail>,
  },
  {
    path: '/pay/result',
    element: <PayResult></PayResult>,
  },
]

const Router = () => {
  const RouterView = () => useRoutes(Router_List)
  return (
    <React.Suspense>
      <RouterView></RouterView>
    </React.Suspense>
  )
}

export default Router
